package kr.hikt.androidcomplete01.ch07;

import android.app.Activity;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.os.Bundle;
import android.view.View;

public class Stroke extends Activity {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(new MyView(this));
	}
	
	class MyView extends View{
		private Paint pnt;
		
		public MyView(Context context){
			super(context);
			pnt = new Paint();
		}

		@Override
		protected void onDraw(Canvas canvas) {
			super.onDraw(canvas);
			canvas.drawColor(Color.LTGRAY);
			
			pnt.setColor(Color.BLUE);
			pnt.setStrokeWidth(16);
			canvas.drawLine(50, 30, 240, 30, pnt);
			pnt.setStrokeCap(Paint.Cap.ROUND);
			canvas.drawLine(50, 60, 240, 60, pnt);
			pnt.setStrokeCap(Paint.Cap.SQUARE);
			canvas.drawLine(50, 90, 240, 90, pnt);
			
			pnt.setColor(Color.BLACK);
			pnt.setStrokeWidth(20);
			pnt.setStyle(Paint.Style.STROKE);
			pnt.setStrokeJoin(Paint.Join.MITER);
			canvas.drawRect(50, 150, 90, 200, pnt);
			pnt.setStrokeJoin(Paint.Join.BEVEL);
			canvas.drawRect(120, 150, 160, 200, pnt);
			pnt.setStrokeJoin(Paint.Join.ROUND);
			canvas.drawRect(190, 150, 230, 200, pnt);
		}
		
		
	}
}
